﻿using System;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public static void Main()
    {
        WithInterfaces.MainMenu MainMenuWithInterfaces = buildWithInterfacesMainMenu();
        MainMenuWithInterfaces.Show();

        WithDelegates.MainMenu MainMenuWithDelegates = buildWithDelegatesMainMenu();
        MainMenuWithDelegates.Show();
    }

    private static WithInterfaces.MainMenu buildWithInterfacesMainMenu()
    {
        WithInterfaces.MainMenu mainMenu = new WithInterfaces.MainMenu();

        mainMenu.AddMenuItem(new WithInterfaces.ActionMenuItem(2, new ShowWelcome()));

        ShowDate showDate = new ShowDate();
        ShowTime showTime = new ShowTime();

        mainMenu.AddMenuItem(new WithInterfaces.SubMenuItem(2, "Show Date/Time", new WithInterfaces.ActionMenuItem(3, showDate), new WithInterfaces.ActionMenuItem(3, showTime)));

        mainMenu.AddMenuItem(new WithInterfaces.ActionMenuItem(2, new ShowVersion()));

        mainMenu.Show();

        return mainMenu;
    }

    private static WithDelegates.MainMenu buildWithDelegatesMainMenu()
    {
        WithDelegates.MainMenu mainMenu = new WithDelegates.MainMenu();

        WithDelegates.ActionMenuItem ShowWelcomeActionMenuItem = new WithDelegates.ActionMenuItem(2, "Show Welcome");
        
        ShowWelcomeActionMenuItem.Click += ShowActionsMethods.ShowWelcome_Click;
        mainMenu.AddMenuItem(ShowWelcomeActionMenuItem);

        WithDelegates.ActionMenuItem DateActionMenuItem = new WithDelegates.ActionMenuItem(3, "Show Date");

        DateActionMenuItem.Click += ShowActionsMethods.ShowDate_Click;

        WithDelegates.ActionMenuItem TimeActionMenuItem = new WithDelegates.ActionMenuItem(3, "Show Time");
        TimeActionMenuItem.Click += ShowActionsMethods.ShowTime_Click;

        WithDelegates.SubMenuItem subMenuItem = new WithDelegates.SubMenuItem(2, "Show Date / Time", DateActionMenuItem, TimeActionMenuItem);
        mainMenu.AddMenuItem(subMenuItem);

        WithDelegates.ActionMenuItem ShowVersionMenuItem = new WithDelegates.ActionMenuItem(2, "Show Version");
        ShowVersionMenuItem.Click += ShowActionsMethods.ShowVersion_Click;
        mainMenu.AddMenuItem(ShowVersionMenuItem);

        return mainMenu;
    }
}
